<?php
function writeViSeminar($viSeminar) {
    $styleClass = '';
    if (! $viSeminar['active']) {
        $styleClass .= 'locked ';
    }
    if (date::dateIntervalIncludesToday($viSeminar['begin_date'], $viSeminar['end_date'])) {
        $styleClass .= 'currentSeminarItem';
        
    }
    
    echo '<li class="' . $styleClass . '">';
    
    echo html::anchor('/admin/viSeminar/display?id=' . $viSeminar['id'], $viSeminar['name']) . ' (' . format::date($viSeminar['begin_date']) . ' - ' . format::date($viSeminar['end_date']) . ')';
    echo ', ' . html::anchor('admin/viSeminar/viRegistrationList?id=' . $viSeminar['id'],
            text::get('admin.registrationList-short', $viSeminar['registrationCount']));
    echo '</li>';
}

// Upcoming seminars
if (count($upcomingViSeminarList) > 0) {
    echo '<h4>' . text::getEscaped('admin.upcomingViSeminars') . '</h4>';
    echo '<ul>';
    foreach ($upcomingViSeminarList as $viSeminar) {
        writeViSeminar($viSeminar);
    }
    echo '</ul>';
}

// Recent seminars
if (count($recentViSeminarList) > 0) {
    echo '<h4>' . text::getEscaped('admin.recentViSeminars') . '</h4>';
    echo '<ul>';
    foreach ($recentViSeminarList as $viSeminar) {
        writeViSeminar($viSeminar);
    }
    echo '</ul>';
}

echo '<p class="description">&#8230;' . html::anchor('admin/viSeminar/all', text::get('admin.allViSeminars')) . '</p>';
?>